<template>
  <div class="private">
    <van-nav-bar
      title="个人信息"
      left-arrow
      @click-left="onClickLeft"
    />
    <div class="private-items">
      <div class="private-item"><van-cell title="个人资料"  @click="pushPriData"  is-link size="large" right-icon="@"/></div>
      <div class="private-item"><van-cell title="实名认证"  @click="pushAuthen" is-link size="large"/></div>
      <div class="private-item count"><van-cell title="我的账号"  is-link size="large" :value="phoneNumber | phone" @click="pushMycount" /></div>
    </div>
  </div>
</template>

<script>
export default {
  data(){
    return {
      phoneNumber:'',
    }
  },
  created(){
    this.getindexInfo()
  },
  filters : {
    phone(value){
      if(value==null) return ' '
      var showPhone =  value.replace(/^(\d{3})\d{4}(\d+)/,"$1****$2")
      return showPhone
    }
  },
  methods: {
    // 路由到个人资料页
    pushPriData(){
      this.$router.push('/privateData');
    },
    // 路由到 “我的账号” 页
    pushMycount(){
      this.$router.push('/myAcount');
      
    },
    // 路由到 “实名认证” 页
    pushAuthen() {
      this.$router.push('/authentication');
    },
    // 返回上一层路由
    onClickLeft(){
      this.$router.push('/profile')
    },
    // 获取手机号
    getindexInfo(){
      this.phoneNumber = this.$store.state.userInfo.phone_number
    }
  }
}
</script>

<style lang="less">
.private-items {
  margin-top: 10px;
  .private-item {
    margin-top: 1px;
  }
  .count {
    margin-top: 18px;
  }

}
</style>